﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace WebCinesItech
{
    public partial class frmConsultaCinePelicula : System.Web.UI.Page
    {
        localhost.Service oWs = new localhost.Service();
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet tblcines = new DataSet();
            DataSet tblPelicula = new DataSet();


            tblcines = oWs.ListarCines();
            tblPelicula = oWs.ListarPelicula();


            cboListaCine.DataSource = tblcines;
            cboListaCine.DataTextField = "nombre";
            cboListaCine.DataValueField = "cod_cine";
            cboListaCine.DataBind();

            cboListaPelicula.DataSource = tblPelicula;
            cboListaPelicula.DataTextField = "titulo";
            cboListaPelicula.DataValueField = "pelicula_ID";
            cboListaPelicula.DataBind();
        }

        protected void btnConsulta_Click(object sender, EventArgs e)
        {
            DataSet tbldatos = new DataSet();

            tbldatos = oWs.ListarCinesPeliculas(cboListaCine.SelectedValue.ToString(), cboListaPelicula.SelectedValue.ToString());



            dgListado.DataSource = tbldatos.Tables[0];
            dgListado.DataBind();
        }

        protected void rbcines_CheckedChanged(object sender, EventArgs e)
        {
            if (rbcines.Checked == true)
            {
                Label1.Visible = true;
                cboListaCine.Visible = true;
                Label3.Visible = false;
                cboListaPelicula.Visible = false;
            }
        }

        protected void rdbPelicula_CheckedChanged(object sender, EventArgs e)
        {
            Label1.Visible = false;
            cboListaCine.Visible = false;
            Label3.Visible = true;
            cboListaPelicula.Visible = true;
        }
    }
}